package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.TechnicianMapper;
import com.rzj.sys_lab_assistant.entity.Technician;
import com.rzj.sys_lab_assistant.service.ITechnicianService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-06-29 16:29
 */
@Service
public class TechnicianServiceImpl implements ITechnicianService {

    @Autowired
    TechnicianMapper technicianMapper;

    TimeUtils timeUtils;

    @Override
    public List<Technician> listTechnicians() {
        return technicianMapper.listTechnicians();
    }

    @Override
    public Technician getTechnicianById(String account) {
        return technicianMapper.getTechnicianById(account);
    }

    @Override
    public int saveTechnician(Technician technician) {
        technician.setCreateTime(timeUtils.getTime());
        technician.setModifyTime(timeUtils.getTime());

        return technicianMapper.saveTechnician(technician);
    }

    @Override
    public int updateTechnician(Technician technician) {
        technician.setModifyTime(timeUtils.getTime());
        return technicianMapper.updateTechnician(technician);
    }

    @Override
    public int deleteTechnician(String account) {
        return technicianMapper.deleteTechnician(account);
    }
}
